package com.evil.common.application.dto.permission.app;

import com.evil.common.application.enums.permission.PermissionStatusEnum;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.List;

/**
 * 应用权限 实体
 *
 * @author liyang
 * @date 2022-08-08 00:00
 */
@Data
public class AppPermissionsListDTO {

    /**
     * 权限状态(0:全体, 1:指定)
     */
    @NotNull(message = "权限状态参数不能为空")
    @Range(min = 0, max = 1, message = "权限状态参数错误")
    private Integer permissionStatus;

    @Valid
    private List<AppPermissionDTO> permissions;

    public AppPermissionsListDTO() {
        this.permissionStatus = PermissionStatusEnum.ALL.getId();
        this.permissions = new ArrayList<>();
    }

}
